<?php

class Exam_Form_Admin_Category_Create extends Engine_Form {
	public function init() {
		$this->setMethod('post')
			->setTitle('Create Category');
			
		
		$this->addElement('Select', 'parent_id', array(
				'label'	=>	'Parent category'
			)
		);
		
		$this->parent_id->setAttrib('id', 'parent_id');
		
		$this->addElement('Text', 'title', array(
				'label'	=>	'Category Name',
				'required'	=>	true,
				'notEmpty' => true
			)
		);
				
		
		// Buttons
		$this->addElement('Button', 'submit', array (
				'label' => 'Add Category', 
				'type' => 'submit', 
				'ignore' => true, 
				'decorators' => array (
						'ViewHelper'
				)
		));
		$this->addElement('Cancel', 'cancel', array (
				'label' => 'cancel', 
				'link' => true, 
				'prependText' => ' or ', 
				'onclick' => 'parent.Smoothbox.close();', 
				'decorators' => array (
						'ViewHelper'
				)
		));
		$this->addDisplayGroup(array (
				'submit', 
				'cancel'
		), 'buttons');
		$button_group = $this->getDisplayGroup('buttons');
		$button_group->addDecorator('DivDivDivWrapper');
		
		// Set default action
		$this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
	}	
}